<template>
  <view class="container" @click="handlerClick">
    <image :src="getImageOssUrl('/common/scroll-top.png')"/>
  </view>
</template>

<script>
  /* 返回顶部按钮：在mixin中定义了节流函数（throttle）。
  示例：
  onPageScroll(e) {
    let self = this;
    function getStatus(result){
      self.scrollTopVisible = result // 给组件设置v-if='scrollTopVisible'判断是否显示返回顶部按钮
    }
    this.thottle(e, getStatus)
  }
  */
	export default {
    methods: {
      handlerClick() {
        uni.pageScrollTo({
          scrollTop: 0,
          duration: 300
        })
      }
    },
  }
</script>

<style>
  .container {
    background-color: rgba(0,0,0,0.5);
    width: 70upx;
    height: 70upx;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 5rpx;
    padding-left: 5rpx;
    border-bottom-left-radius:10rpx;
    border-top-left-radius:10rpx;
    position: fixed;
    right: 0rpx;
    bottom: 200rpx;
    z-index: 999;
  }
  .container image {
    width: 40upx;
    height: 40upx;
  }
</style>
